<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script src="./js/react.development.js"></script>
  <script src="./js/react-dom.development.js"></script>
  <script src="./js/babel.min.js"></script>
  <title>Document</title>
  <style>
    div {
      width: 200px;
      height: 100px;
      background: #acf;
    }
  </style>
</head>

<body>
  <div id="root"></div>

  <script type="text/babel">
    let vdom = <div>
      <h2>点击事件</h2>
      <div onClick={(e)=>{
        e.target.style.background='red'
      }}></div>
      <h2>移入事件</h2>
      <div onMouseOver={(e)=>{
        e.target.style.background='#666'
      }}
      onMouseOut={e=>{
        e.target.style.background='#acf'
      }}></div>
      <h2>获取事件源</h2>
      <div onClick={e=>{
        console.log(e.target);
      }}></div>
    </div>
    ReactDOM.render(vdom,document.querySelector('#root'))
  </script>
</body>

</html>